/*
Gallery slider
==============================================
Styling for gallery slider component.
Displays images in a slider gallery with thumbnail navigation.
based on "base-slider" component and "tiny-slider" (https://github.com/ganlanyuan/tiny-slider)
*/

.gallery-slider {
    // correct perceptual issue with tiny slider
    width: 99.9%;

    &.has-nav-outside .gallery-slider-item-container {
        padding: 0 25px;
    }
}

.gallery-slider-row {
    margin-bottom: $spacer;

    &.is-loading {
        height: auto;
        overflow: hidden;

        .gallery-slider-item-container {
            &:not(:first-child) {
                display: none;
            }
        }

        .gallery-slider-thumbnails-col.is-underneath {
            display: none;
        }
    }

    &.is-single-image {
        justify-content: center;
    }
}

.gallery-slider-single-image {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-slider-container {
    position: relative;
    height: 100%;

    .gallery-slider-image {
        display: block;
    }
}

.gallery-slider-item,
.gallery-slider-single-image {
    position: relative;
    backface-visibility: hidden;
    cursor: default;
    display: block;
    height: 100%;
    max-width: 100%;

    &.is-cover,
    &.is-contain {
        height: 100%;

        .gallery-slider-image {
            object-fit: cover;
            position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            margin: 0 auto;
        }
    }

    &.is-cover {
        .gallery-slider-image {
            object-fit: cover;
            width: 100%;
            height: 100%;
        }
    }

    &.is-contain {
        .gallery-slider-image {
            margin: auto;
            object-fit: contain;
        }
    }
}

.gallery-slider-controls-prev {
    left: 0;

    &.is-nav-prev-outside {
        left: 0;
    }
}

.gallery-slider-controls-next {
    right: 0;

    &.is-nav-next-outside {
        right: 0;
    }
}

// Thumbnails
.gallery-slider-thumbnails-container {
    position: relative;

    .tns-inner {
        display: flex;
        justify-content: center;
    }

    &.is-underneath {
        .tns-inner {
            display: block;
        }

        .tns-outer {
            margin: 0 30px;
        }
    }

    &.hide-thumbs {
        display: none;
    }
}

.gallery-slider-thumbnails-col {
    .gallery-slider-thumbnails-controls-prev,
    .gallery-slider-thumbnails-controls-next {
        border: 0;
        background: none;
        height: 30px;
        width: 65px;
        line-height: normal;
    }

    &.is-left {
        padding-right: 0;

        .gallery-slider-thumbnails-controls-prev {
            top: -30px;
        }

        .gallery-slider-thumbnails-controls-next {
            bottom: -20px;
            top: auto;
        }

        .gallery-slider-thumbnails-controls-prev,
        .gallery-slider-thumbnails-controls-next {
            left: 50%;
            transform: translateX(-50%);
        }
    }

    &.is-underneath {
        .gallery-slider-thumbnails-controls-prev {
            left: -25px;
        }

        .gallery-slider-thumbnails-controls-next {
            right: -25px;
        }

        .gallery-slider-thumbnails-controls-prev,
        .gallery-slider-thumbnails-controls-next {
            transform: translateY(-30%);
        }
    }
}

.gallery-slider-modal-controls {
    z-index: 10;

    .gallery-slider-thumbnails-controls-prev {
        left: 0;
    }

    .gallery-slider-thumbnails-controls-next {
        right: 0;
    }
}

.gallery-slider-thumbnails {
    &.is-underneath {
        display: flex;
        margin-top: $spacer;

        .gallery-slider-thumbnails-item {
            width: auto;
        }
    }
}

.gallery-slider-thumbnails-item {
    cursor: pointer;
    height: 75px;
    width: 75px;

    &.tns-nav-active {
        .gallery-slider-thumbnails-item-inner {
            border-color: $primary;
        }
    }
}

.gallery-slider-thumbnails-item-inner {
    border: 1px solid $border-color;
    border-radius: $border-radius;
    width: 100%;
    height: 100%;
    padding: $spacer-xs;
    display: flex;
    align-items: center;
    align-content: center;
    justify-content: center;
    position: relative;
}

.gallery-slider-thumbnails-image,
.gallery-slider-image {
    flex: 0 0 auto;
    max-height: 100%;
    max-width: 100%;
}

.gallery-slider-thumbnails-play-button {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;

    &::before,
    &::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
    }

    &::before {
        transform: translate(-50%, -50%);
        width: 25px;
        height: 25px;
        border-radius: 50%;
        background-color: rgba(0, 0, 0, 0.5);
    }

    &::after {
        transform: translate(-40%, -50%);
        border-top: 6px solid transparent;
        border-bottom: 6px solid transparent;
        border-left: 9px solid $white;
    }
}

.gallery-slider-thumbnails-controls {
    display: none;
    margin: 0;
}

// @experimental stableVersion:v6.8.0 feature:SPATIAL_BASES
.gallery-slider-canvas-disabled {
    .spatial-canvas-spinner {
        display: none;
    }
    .gallery-slider-spatial-canvas-wrapper {
        display: none;
    }
}

// @experimental stableVersion:v6.8.0 feature:SPATIAL_BASES
.spatial-canvas-note {
    position: absolute;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%);
    background-color: $gray-600;
    color: $sw-background-color;
    padding: 0 8px;
    border-radius: 8px;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;

    &.spatial-canvas-note--hidden {
        opacity: 0;
    }

    &.spatial-slider-movement-note {
        bottom: 86px;
    }
}

// @experimental stableVersion:v6.8.0 feature:SPATIAL_BASES
.ar-button {
    top: 10px;
    right: 9px;
    height: 32px;
    border: 2px solid $gray-300;
    border-radius: 5px;
    background-color: $white;

    .icon-augmented {
        height: 18px;
        width: 18px;
        margin-right: 5px;

        svg {
            top: unset;
        }
    }

    &:hover {
        box-shadow: 0 0 11px $gray-300;
    }
}

// @experimental stableVersion:v6.8.0 feature:SPATIAL_BASES
.gallery-slider-spatial-canvas-wrapper {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;

    &.spatial-canvas-display {
        background-color: $sw-background-color;
        opacity: 1;
    }
}

@include media-breakpoint-down(sm) {
    // override inline style on mobile devices
    .gallery-slider-item {
        &.is-cover,
        &.is-contain {
            min-height: 225px !important;
        }
    }
}

@include media-breakpoint-down(md) {
    .gallery-slider-single-image {
        &.is-cover,
        &.is-contain {
            min-height: 225px !important;
        }
    }
}

@include media-breakpoint-up(md) {
    .gallery-slider-row {
        justify-content: center;
    }

    .gallery-slider-thumbnails-controls {
        display: block;
    }

    .gallery-slider-thumbnails-col {
        &.is-left {
            .gallery-slider-thumbnails-item {
                // fixes problem with margin of next button (arrow)
                // thumbnail slider height calculation is not working with margin but it works with padding
                margin-bottom: 0 !important;
                padding-bottom: 10px;
            }
        }
    }
}
